package com.xyf.sys.service.impl;

import com.xyf.sys.domain.OrderProfitsharing;
import com.xyf.sys.mapper.OrderProfitsharingMapper;
import com.xyf.sys.service.IOrderProfitsharingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author R-H
 * @Date 2024/7/151024
 * @Description
 */
@Service
@Slf4j
public class OrderProfitsharingServiceImpl implements IOrderProfitsharingService {

    @Autowired
    private OrderProfitsharingMapper mapper;

    @Override
    public List<OrderProfitsharing> getOrderProfitsharingList(String orderId) {
        return this.getOrderProfitsharingList(orderId, null);
    }

    @Override
    public List<OrderProfitsharing> getOrderProfitsharingList(String orderId, String outOrderNo) {
        return mapper.selectByOrderIdAndOutOrderNo(orderId, outOrderNo);
    }

    @Override
    public int save(OrderProfitsharing profitsharing) {
        profitsharing.setCreateTime(new Date());
        profitsharing.setStatus("0");
        profitsharing.setDelFlag("0");
        return mapper.insert(profitsharing);
    }

    @Override
    public int update(OrderProfitsharing orderProfitsharing) {
        orderProfitsharing.setUpdateTime(new Date());
        return mapper.updateByPrimaryKeySelective(orderProfitsharing);
    }

}
